package com.lvmama.pet.sync.service;

import java.util.HashMap;
import java.util.Map;

public class SyncDataContext {
	
	public static final String TRIGGER_DATA = "TRIGGER_DATA";

	static final ThreadLocal<Map<String, Object>> THREAD_LOCAL = new ThreadLocal<Map<String,Object>>();
	
	public static void put(String key, Object v) {
		Map<String, Object> map = THREAD_LOCAL.get();
		if (map == null) {
			map = new HashMap<String, Object>();
			THREAD_LOCAL.set(map);
		}
		map.put(key, v);
	}
	
	public static Object get(String key) {
		Map<String, Object> map = THREAD_LOCAL.get();
		if (map != null) {
			return map.get(key);
		}
		return null;
	}

	public static void remove() {
		THREAD_LOCAL.remove();
	}
}
